# 有两个磁盘文件A和B,各存放一行字母,要求把这两个文件中的信息合并(按字母顺序排列), 输出到一个新文件C中。

# 打开源文件和目标文件
with open('1.txt', 'r', encoding='utf-8') as source_file1, \
        open('2.txt', 'r', encoding='utf-8') as source_file2, \
        open('3.txt', 'w', encoding='utf-8') as destination_file:
    # 逐行读取源文件1
    for line in source_file1:
        # 写入到目标文件
        destination_file.write(line)

    # 逐行读取源文件2
    for line in source_file2:
        # 写入到目标文件
        destination_file.write(line)
